home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: lugb.latrobe.edu.au!latcs1!woelkerl
- From: woelkerl@lion.cs.latrobe.edu.au (Eric Woelkerling)
- Subject: Pointer to Functions and Calls thereof??
- X-Nntp-Posting-Host: lion.cs.latrobe.edu.au
- Message-ID: <Dq01Ft.Dqn@latcs1.lat.oz.au>
- Sender: news@latcs1.lat.oz.au (news)
- Organization: Comp.Sci & Comp.Eng, La Trobe Uni, Australia
- X-Newsreader: TIN [version 1.2 PL2]
- Date: Wed, 17 Apr 1996 09:09:28 GMT
-
- Hi! Can anybody fill me in as to how to get a pointer to a function
- and then use this to do the call?? I have a situation where a particular function
- will be selected from a set of functions and used throughout my entire code,
- but the function selected will depend on the runtime selection by thge user..
-
- so far.. I have got as far as..
-
-
- void func1(void){naughty bits}
- void func2(void){naughty bits}
-
- void main(void)
- { void *a[1];
-
- a[1]=func1;
- a[2]=func2;
-
- (*a[1])();
- }
-
- Is there something obvious I am missing here?? I am on a PC and using
- borland c++ compiler...
-
- If you can help, please mail me directly Thanks!
-
- Eric Woelkerling
- woelkerl@lion.lat.oz.au
-
-